<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
<!-- HTTP 1.1 -->
<meta http-equiv="Cache-Control" content="no-store">
<!-- HTTP 1.0 -->
<meta http-equiv="Pragma" content="no-cache">
<title><html:text name="sys.name" /></title>
<script language="javascript" type="text/javascript" src="<%=WEBPATH%>/scripts/global.js?s=<%=generate%>"></script>

<style type="text/css">
.error,.required{
	color:red;
}
</style>
<!-- Prevents caching at the Proxy Server -->
<meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
	function setFocus(){
		var userName=_$("username");
		var password=_$("password");
		if (userName.value != '') {
			password.focus();
			//password.select();
		}
		else userName.focus();
	}
	function enterKeyPress(event)
	  {
	  	if(event.keyCode == 13)
	  	{
	  		loginFunction();
	  	}  	
	  }
	  function loginFunction(){
		 // var success=document.getElementById("success-return");
		  var userNameObj=_$("username");
		  var passwordObj=_$("password");
		  var responseObj=_$("j_captcha_response");
		  var errorMessage=_$("post_error");
		  var formObj=_$("formBean");
		  var loginObj=_$("login");
		  	
		  	if(userNameObj.value == "")
		  	{
		  		userNameObj.focus();
		  		errorMessage.innerHTML="<fmt:message key="login.error.invalidUserName"></fmt:message>";
		  		return false;
		  	}
		  	
		  	if(passwordObj.value == "")
		  	{
		  		passwordObj.focus();
		  		errorMessage.innerHTML="<fmt:message key="login.error.invalidPassword"></fmt:message>";
		  		return false;
		  	}
		  	if(responseObj.value == "")
		  	{
		  		passwordObj.focus();
		  		errorMessage.innerHTML="<fmt:message key="login.error.invalidValidateId"></fmt:message>";
		  		return false;
		  	}		    
		  	loginObj.disabled = true;
		  	formObj.submit();
	  }
</script>
</head>
<body onload="javascript:setFocus()">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div id="content">
<form id="formBean" name="formBean" method="post" action="login.crm">
<table height="300" align="center" width="400" cellpadding="0"
	cellspacing="0" border="0"
	style="border:0px;">
	<tr>
		<td class="body" style="padding-bottom: 10px;"><b><fmt:message
			key="login.welcome" /> </b></td>
	</tr>
	<tr>
		<td class="tabForm" align="center" valign="top">
		<table cellpadding="0" cellspacing="2" border="0" align="center"
			width="100%"> 
			<tr>
				<td class="dataLabel" colspan="2"><span id='post_error'
					class="error"><html:fielderror></html:fielderror><html:actionerror /> </span></td>
			</tr>
			<tr>
				<td class="dataLabel" width="30%"><fmt:message
					key="login.userName" /></td>
				<td width="70%"><input type='text' name='username'
					id="username" class="editor_style" dataType="varchar" style="width:90%;"><span
					class="required">*</span></td>
			</tr>
			<tr>
				<td class="dataLabel" width="30%"><fmt:message
					key="login.password" /></td>
				<td width="70%"><input type='password' id="password"
					name='password' class="editor_style"  dataType="varchar" style="width:90%;"><span
					class="required">*</span></td>
			</tr>
			<tr>
				<td class="dataLabel" width="30%"><fmt:message
					key="login.validate" /></td>
				<td width="70%" valign="bottom"><input type="text" name="j_captcha_response"
					id="j_captcha_response" class="editor_style" 
					onkeypress="enterKeyPress(event);" dataType="varchar" style="width:64%;"><span
					class="required">*</span>&nbsp;<img width="60" height="20" src="<c:url value='/showImage' />" style="border:0px;"></td>
			</tr>
			<tr>
				<td class="dataLabel" width="30%"><input type="checkbox"
					id="_spring_security_remember_me"
					name="_spring_security_remember_me" /></td>
				<td><fmt:message key="login.rememberMe" /></td>
			</tr>
			<tr>
				<td colspan='2' align="center"><input class="button"
					value=" <fmt:message key="login.loginin" /> "
					onclick="loginFunction();" type="button" name="login" id="login" /></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</div>
<jsp:include flush="true" page="/WEB-INF/jsp/include/divbottom.jsp" />
</body>
</html>